package cn.sccl.common.scaffold.filegens;

import cn.sccl.common.scaffold.FileConfig;
import cn.sccl.common.scaffold.FileGenerator;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by 杨浩宇 on 2016-02-21.
 */
public class DAOFileGenerator extends FileGenerator {
    @Override
    public String getTemplate() {
        return "dao.ftl";
    }

    @Override
    public boolean storeToJavaSrc() {
        return true;
    }

    @Override
    public String getTargetPath(String projectPath, String packagePath, String modelName) {
        return projectPath + "/" + packagePath + "/dao/" + modelName + "DAO.java";
    }

    @Override
    public Map fillParams(FileConfig fileConfig) {
        Map map = new HashMap();
        map.put("package", fileConfig.getBasePackage() + ".dao");
        map.put("modelClass", fileConfig.getBasePackage() + ".model." + fileConfig.getModelName());
        map.put("modelName", fileConfig.getModelName());
        map.put("tableComments", fileConfig.getTableInfo().getTableComments());

        return map;
    }


}
